//作业运行时间分析////
var d_chart3 = document.getElementById('chart3');
var p_chart3 = document.getElementById('p_chart3');
var resizeWorldMapContainer3 = function () {
    d_chart3.style.width = p_chart3.clientWidth +'px';
    d_chart3.style.height = p_chart3.clientHeight +'px';
};
resizeWorldMapContainer3();

var chart3 = echarts.init(d_chart3, 'vintage');
$('#jobMonitoring').on('opened.collapse.amui', function() {
    resizeWorldMapContainer3();
    chart3.resize();
    resizeWorldMapContainer4();
    chart4.resize();
    resizeWorldMapContainer5();
    chart5.resize();
}).on('closed.collapse.amui', function() {
    resizeWorldMapContainer3();
    chart3.resize();
    resizeWorldMapContainer4();
    chart4.resize();
    resizeWorldMapContainer5();
    chart5.resize();
});
$('#jobMonitoring-endDate').text(myDate.getFullYear()+"-"+parseInt(myDate.getMonth()+1)+"-"+myDate.getDate());
$('#jobMonitoring-start').datepicker().
on('changeDate.datepicker.amui', function(event) {
    console.log(endDate.valueOf());
    console.log(event.date.valueOf());
    if (event.date.valueOf() > endDate.valueOf()) {
        layer.alert('开始日期应小于结束日期！');
    } else {
        startDate = new Date(event.date);
        $('#jobMonitoring-startDate').text($('#jobMonitoring-start').data('date'));
    }
    $(this).datepicker('close');
});
$('#jobMonitoring-end').datepicker().
on('changeDate.datepicker.amui', function(event) {
    if (event.date.valueOf() < startDate.valueOf()) {
        layer.alert('结束日期应大于开始日期！');
    } else {
        endDate = new Date(event.date);
        $('#jobMonitoring-endDate').text($('#jobMonitoring-end').data('date'));
    }
    $(this).datepicker('close');
});
chart3.setOption({
    title :{
        text: '运行时间(按软件统计)',
        subtext: '时间：'+yesterday.toLocaleDateString()+'至'+myDate.toLocaleDateString()
    },
    tooltip : {
        trigger: 'axis',
        axisPointer : {
            type : 'shadow'
        }
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            restore : {show: true},
            saveAsImage : {show: true},
            right: '20%'
        }
    },
    legend: {
        data:[]
    },
    grid: {
        top: '18%',
        left: '10%',
        right: '10%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            name : '软件',
            data : []
        }
    ],
    yAxis : [
        {
            type : 'value',
            name: '软件运行时间(核*小时)'
        }
    ],
    series : []
});

var d_chart4 = document.getElementById('chart4');
var p_chart4 = document.getElementById('p_chart4');
var resizeWorldMapContainer4 = function () {
    d_chart4.style.width = p_chart4.clientWidth +'px';
    d_chart4.style.height = p_chart4.clientHeight +'px';
};
resizeWorldMapContainer4();

var chart4 = echarts.init(d_chart4, 'vintage');

chart4.setOption({
    title :{
        text: '计算时间(按软件统计)',
        subtext: '时间：'+yesterday.toLocaleDateString()+'至'+myDate.toLocaleDateString()
    },
    tooltip : {
        trigger: 'axis',
        axisPointer : {
            type : 'shadow'
        }
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            restore : {show: true},
            saveAsImage : {show: true},
            right: '20%'
        }
    },
    legend: {
        data:[]
    },
    grid: {
        top: '18%',
        left: '10%',
        right: '10%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            name : '软件',
            data : []
        }
    ],
    yAxis : [
        {
            type : 'value',
            name: '软件计算时间(核*小时)'
        }
    ],
    series : []
});

var d_chart5 = document.getElementById('chart5');
var p_chart5 = document.getElementById('p_chart5');
var resizeWorldMapContainer5 = function () {
    d_chart5.style.width = p_chart5.clientWidth +'px';
    d_chart5.style.height = p_chart5.clientHeight +'px';
};
resizeWorldMapContainer5();

var chart5 = echarts.init(d_chart5, 'vintage');

chart5.setOption({
    title :{
        text: '运行效率(按软件统计)',
        subtext: '时间：'+yesterday.toLocaleDateString()+'至'+myDate.toLocaleDateString()
    },
    tooltip : {
        trigger: 'axis',
        axisPointer : {
            type : 'shadow'
        }
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            restore : {show: true},
            saveAsImage : {show: true},
            right: '20%'
        }
    },
    legend: {
        data:[]
    },
    grid: {
        top: '18%',
        left: '10%',
        right: '10%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            name : '软件',
            data : []
        }
    ],
    yAxis : [
        {
            type : 'value',
            name: '软件运行效率(%)'
        }
    ],
    series : []
});

$("#jobMonitoringSearch").click(function() {
    $("#jobMonitoringIsSearch").val(1);
    $("#jobMonitoringStartDateTemp").val($("#jobMonitoring-startDate").html());
    $("#jobMonitoringEndDateTemp").val($("#jobMonitoring-endDate").html());
    $("#jobMonitoringSearchContentTemp").val($("#jobMonitoringSearchContent").val());
});